home *** CD-ROM | disk | FTP | other *** search
- head 1.2;
- branch ;
- access ;
- symbols sprited:1.2.1;
- locks ; strict;
- comment @ * @;
-
-
- 1.2
- date 88.08.25.14.40.53; author brent; state Exp;
- branches 1.2.1.1;
- next 1.1;
-
- 1.1
- date 88.06.19.14.31.04; author ouster; state Exp;
- branches ;
- next ;
-
- 1.2.1.1
- date 91.12.10.15.41.32; author kupfer; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.2
- log
- @Re-implemented using the new Fs_SetAttr system call
- @
- text
- @/*
- * chmod.c --
- *
- * Procedure to map from Unix chmod and fchmod system calls to Sprite.
- *
- * Copyright 1986 Regents of the University of California
- * All rights reserved.
- */
-
- #ifndef lint
- static char rcsid[] = "$Header: chmod.c,v 1.1 88/06/19 14:31:04 ouster Exp $ SPRITE (Berkeley)";
- #endif not lint
-
- #include "sprite.h"
- #include "fs.h"
-
- #include "compatInt.h"
- #include <errno.h>
-
-
- /*
- *----------------------------------------------------------------------
- *
- * chmod --
- *
- * Procedure to map from Unix chmod system call to Sprite
- * Fs_SetAttr system call.
- *
- * Results:
- * UNIX_SUCCESS - the call was successful.
- * UNIX_ERROR - the call was not successful.
- * The actual error code stored in errno.
- *
- * Side effects:
- * The protection of the specified file is modified.
- *
- *----------------------------------------------------------------------
- */
-
- int
- chmod(path, mode)
- char *path;
- int mode;
- {
- ReturnStatus status; /* result returned by Sprite system calls */
- Fs_Attributes attributes; /* struct containing all file attributes,
- * only mode is looked at. */
-
- attributes.permissions = mode;
- status = Fs_SetAttr(path, FS_ATTRIB_FILE, &attributes, FS_SET_MODE);
- if (status != SUCCESS) {
- errno = Compat_MapCode(status);
- return(UNIX_ERROR);
- } else {
- return(UNIX_SUCCESS);
- }
- }
-
- /*
- *----------------------------------------------------------------------
- *
- * fchmod --
- *
- * Procedure to map from Unix fchmod system call to Sprite
- * Fs_SetAttributesID system call.
- *
- * Results:
- * UNIX_SUCCESS - the call was successful.
- * UNIX_ERROR - the call was not successful.
- * The actual error code stored in errno.
- *
- * Side effects:
- * The protection of the specified file is modified.
- *
- *----------------------------------------------------------------------
- */
-
- int
- fchmod(fd, mode)
- int fd;
- int mode;
- {
- ReturnStatus status; /* result returned by Sprite system calls */
- Fs_Attributes attributes; /* struct containing all file attributes,
- * only mode is looked at. */
-
- attributes.permissions = mode;
- status = Fs_SetAttrID(fd, &attributes, FS_SET_MODE);
- if (status != SUCCESS) {
- errno = Compat_MapCode(status);
- return(UNIX_ERROR);
- } else {
- return(UNIX_SUCCESS);
- }
- }
- @
-
-
- 1.2.1.1
- log
- @Initial branch for Sprite server.
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: /sprite/src/lib/c/unixSyscall/RCS/chmod.c,v 1.2 88/08/25 14:40:53 brent Exp $ SPRITE (Berkeley)";
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: chmod.c,v 1.3 87/08/21 14:43:39 nelson Exp $ SPRITE (Berkeley)";
- d27 1
- a27 1
- * Fs_SetAttributes system call.
- d45 3
- a47 2
- ReturnStatus status; /* result returned by Sprite system calls */
- Fs_Attributes attributes; /* struct containing all file attributes */
- a48 5
- status = Fs_GetAttributes(path, FS_ATTRIB_FILE, &attributes);
- if (status != SUCCESS) {
- errno = Compat_MapCode(status);
- return(UNIX_ERROR);
- }
- d50 1
- a50 1
- status = Fs_SetAttributes(path, FS_ATTRIB_FILE, &attributes);
- d84 2
- a85 1
- Fs_Attributes attributes; /* struct containing all file attributes */
- a86 5
- status = Fs_GetAttributesID(fd, &attributes);
- if (status != SUCCESS) {
- errno = Compat_MapCode(status);
- return(UNIX_ERROR);
- }
- d88 1
- a88 1
- status = Fs_SetAttributesID(fd, &attributes);
- @
-